﻿
namespace MFramework
{
    public class Singleton<T> where T : Singleton<T>, new()
    {
        public static T Inst
        {
            get
            {
                if (instance == null)
                {
                    instance = new T();
                    instance.Init();
                }
                return instance;
            }
        }
        private static T instance;

        protected Singleton() { }

        protected virtual void Init() { }
    }
}